<?= $this->Html->script('jquery.lightbox-0.5.pack', array('inline'=>false)) ?>
<?= $this->Html->css('jquery.lightbox-0.5', null, array('inline'=>false)) ?>

<script type="text/javascript">
$(function(){
	$('.product-gallery a').lightBox({
		imageLoading: '/img/jquery.lightbox-0.5/lightbox-ico-loading.gif',
		imageBtnClose: '/img/jquery.lightbox-0.5/lightbox-btn-close.gif',
		imageBtnPrev: '/img/jquery.lightbox-0.5/lightbox-btn-prev.png',
		imageBtnNext: '/img/jquery.lightbox-0.5/lightbox-btn-next.png',
		imageBlank: '/img/jquery.lightbox-0.5/lightbox-blank.gif',
		txtImage: 'Slika',
		txtOf: 'od'
	});
});
</script>

<div class="left span23 product-page">
	<?= $product['Product']['description'] ?>
	
	<p><?= $this->element('facebook_share') ?></p>
	
	<? if(!empty($product['ProductImage'])): ?>
	<ul class="product-gallery clean">
		<? foreach($product['ProductImage'] as $image): ?>
		<li><?= $this->Html->link(
			$this->Html->image('products/'.$product['Product']['id']."/".$image['src']."?h=80"),
			'/img/products/'.$product['Product']['id']."/".$image['src'],
			array('escape'=>false, 'title'=>$product['Product']['name'])
		) ?></li>
		<? endforeach; ?>
	</ul>
	<? endif; ?>
	
	<? if(!empty($product['Receipe'])): ?>
		<br clear="all">
		<h1 style="margin:30px 0 0">Recepti <?= $product['Product']['name'] ?></h1>
		<?= $this->element('list_receipes', array('receipes' => $product['Receipe'])) ?>
	<? endif; ?>
</div>

<div class="sidebar right">
	<? if(!empty($related_products)): ?>
    <p><strong>slični proizvodi:</strong></p>
	<ul class="related-products clean">
		<? foreach($related_products as $rp): ?>

        <?
            $max = 20;
            $name = $rp['Product']['name'];
            if (strlen($name)>$max) {
                $name = String::truncate($name, $max);
            }
        ?>
		<li title="<?= $rp['Product']['name'] ?>"><?= $this->Html->link(
				$this->Html->image("products/".$rp['Product']['id'].'/'.@$rp['ProductImage'][0]['src'] . "?w=140"),
				"/proizvodi/proizvod/" . $rp['Product']['id'] . "/" . strtolower(Inflector::slug($rp['Product']['name'],"-")),
				array( 'escape' => false )
			) 
		?><p><?= $name ?></p></li>
		<? endforeach; ?>
	</ul>
	<? endif; ?>
</div>
